﻿using WRJClient.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WRJClient.ViewModel
{
    public class MissionViewModel : BaseViewModel<MissionModel>
    {
        //新建1 、发布2 、已绑定3、已下发4、执行中5、结束6、完成7

        public string StateName
        {
            get
            {
                string stateName = "";
                switch (StaticData.State)
                {
                    case 1:
                        stateName = "新建";
                        break;
                    case 2:
                        stateName = "发布";
                        break;
                    case 3:
                        stateName = "已绑定";
                        break;
                    case 4:
                        stateName = "已下发";
                        break;
                    case 5:
                        stateName = "执行中";
                        break;
                    case 6:
                        stateName = "结束";
                        break;
                    case 7:
                        stateName = "完成";
                        break;
                    default:
                        stateName = "未知";
                        break;
                }
                return stateName;
            }
        }

        public string TypeName
        {
            get
            {
                string typeName = "";
                switch (StaticData.Type)
                {
                    case 1:
                        typeName = "例行";
                        break;
                    case 2:
                        typeName = "临时";
                        break;
                    default:
                        typeName = "未知";
                        break;
                }
                return typeName;

            }
        }

        public bool IsFinished
        {
            get
            {
                if (StaticData.State == 6 || StaticData.State == 7)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
        public bool IsAction
        {
            get
            {
                if (StaticData.State == 4 || StaticData.State == 5)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
        public MissionViewModel(MissionModel model = null) : base(model)
        {
        }


        public override void SetData(MissionModel model)
        {
            base.SetData(model);
            OnPropertyChanged("StateName");
            OnPropertyChanged("TypeName");
        }
    }
}
